﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace YMJF_Service.Common
{
    public class HttpCode
    {
       

        public static string getCodeMessage(int code)
        {
            return Dictionary[code];
        }

        /// <summary>
        ///请求错误
        /// </summary>
        public static int success = 0;

        //----------------------------------1开头2位数：接口安全校验异常------------------------------------------//

        /// <summary>
        /// Authorization不能为空
        /// </summary>
        public static int code11 = 11;

        /// <summary>
        /// Authorization参数格式错误
        /// </summary>
        public static int code12 = 12;

        /// <summary>
        /// 签名字符串校验失败
        /// </summary>
        public static int code13 = 13;

        /// <summary>
        /// 重复提交
        /// </summary>
        public static int code14 = 14;

        /// <summary>
        /// 绑定的APPID不存在
        /// </summary>
        public static int code15 = 15;

        /// <summary>
        /// token已失效，请重新登录
        /// </summary>
        public static int code16 = 16;

        //----------------------------------1开头3位数：账户注册登录异常------------------------------------------//

        /// <summary>
        ///用户名不存在
        /// </summary>
        public static int code101 = 101;

        /// <summary>
        ///密码错误
        /// </summary>
        public static int code102 = 102;

        /// <summary>
        ///添加账户失败
        /// </summary>
        public static int code103= 103;

        //----------------------------------2开头3位数：数据操作异常------------------------------------------//

        /// <summary>
        ///添加失败
        /// </summary>
        public static int Add_Failed = 201;

        /// <summary>
        ///删除失败
        /// </summary>
        public static int Del_Failed = 202;

        /// <summary>
        ///查询失败
        /// </summary>
        public static int Que_Failed = 203;

        /// <summary>
        ///修改失败
        /// </summary>
        public static int Mod_Failed = 204;

        //----------------------------------400：请求错误------------------------------------------//
    
        /// <summary>
        ///请求错误
        /// </summary>
        public static int fail = 400;

        //----------------------------------错误码中文解释------------------------------------------//

        public static Dictionary<int, string> Dictionary = inint();
        public static Dictionary<int, string> inint()
        {
            Dictionary<int, string> dic = new Dictionary<int, string>();
            dic.Add(code11, "Authorization不能为空");
            dic.Add(code12, "Authorization参数格式错误");
            dic.Add(code13, "签名字符串校验失败");
            dic.Add(code14, "重复提交");
            dic.Add(code15, "绑定的APPID不存在");
            dic.Add(code16, "token已失效，请重新登录");
            dic.Add(code101, "用户名不存在");
            dic.Add(code102, "密码错误");
            dic.Add(fail, "请求错误");
            return dic;
        }
    }
}